import request from '@/utils/request'


export function getDepartments(){
    return request({
        url:'/company/department'
    })
}

/**
 * 新增子部门
 * @param {*} data 
 * @returns 
 */
export function addDepartments(data){
    // 配置url,method 参数data
    return request({
        url:'/company/department',
        method:'post',
        data
    })
}

/**
 * 获取部门详情数据
 * @param {*} data 
 * @returns 
 */
 export function getDepartmentsEdit(id){
    // 配置url,method 参数data
    return request({
        url:`/company/department/${id}`,
        method:'get',
    })
}
/**
 * 根据id修改部门详情
 * @param {*} data 
 * @returns 
 */
 export function updateDepartmentsEdit(data){
    // 配置url,method 参数data
    return request({
        url:`/company/department/${data.id}`,
        method:'put',
        data
    })
}

/**
 * 根据id删除部门
 * @param {*} data 
 * @returns 
 */
 export function DelDepartmentsEdit(id){
    // 配置url,method 参数data
    return request({
        url:`/company/department/${id}`,
        method:'delete',
    })
}